import Vue from "vue";
import Vuex from "../Vuex/index";
import home from "./modules/home";
import nav from "./modules/nav";
import { plugin } from "@/Vuex/utils/helper";
Vue.use(Vuex);

export default new Vuex.Store({
  plugins: [plugin()],
  state: {
    age: 50,
  },
  getters: {
    changge(state) {
      return state.age + 5;
    },
  },
  mutations: {
    add(state, data) {
      state.age += data;
    },
  },
  actions: {
    addAge({ commit }, data) {
      setTimeout(() => {
        commit("add", data);
      }, 1000);
    },
    wewewe({ commit }, data) {
      setTimeout(() => {
        commit("add", data);
      }, 1000);
    },
  },
  modules: {
    home,
    nav,
  },
});
